﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SystemUser.aspx.cs" Inherits="ExaminationSys.SystemManage.SystemUser" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>sys_user</title>
    <script src="/View/js/Alert.js" type="text/javascript"></script> 
    <link href="../css/example.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function SetWinData(index) {
            document.getElementById("Hid").value = sys_user_MainStore.getAt(index).get('userid');
            
			document.getElementById("Txtusertypeid").value = sys_user_MainStore.getAt(index).get('usertypeid');
			document.getElementById("Txtuserno").value = sys_user_MainStore.getAt(index).get('userno');
			document.getElementById("Txtusername").value = sys_user_MainStore.getAt(index).get('username');
			document.getElementById("Txtloginname").value = sys_user_MainStore.getAt(index).get('loginname');
			document.getElementById("Txtdiminutive").value = sys_user_MainStore.getAt(index).get('diminutive');
			document.getElementById("Txtpasswold").value = sys_user_MainStore.getAt(index).get('passwold');
			document.getElementById("Txtsex").value = sys_user_MainStore.getAt(index).get('sex');
			document.getElementById("Txtbirthday").value = sys_user_MainStore.getAt(index).get('birthday');
			document.getElementById("Txtcollegeid").value = sys_user_MainStore.getAt(index).get('collegeid');
			document.getElementById("Txtcollegename").value = sys_user_MainStore.getAt(index).get('collegename');
			document.getElementById("Txtmajorid").value = sys_user_MainStore.getAt(index).get('majorid');
			document.getElementById("Txtmajorname").value = sys_user_MainStore.getAt(index).get('majorname');
			document.getElementById("Txttitleid").value = sys_user_MainStore.getAt(index).get('titleid');
			document.getElementById("Txttitle").value = sys_user_MainStore.getAt(index).get('title');
			document.getElementById("Txtrights").value = sys_user_MainStore.getAt(index).get('rights');
			document.getElementById("Txtmobile").value = sys_user_MainStore.getAt(index).get('mobile');
			document.getElementById("Txttelphone").value = sys_user_MainStore.getAt(index).get('telphone');
			document.getElementById("Txtemail").value = sys_user_MainStore.getAt(index).get('email');
			document.getElementById("Txtaddress").value = sys_user_MainStore.getAt(index).get('address');
			document.getElementById("Txtsecurityquestion").value = sys_user_MainStore.getAt(index).get('securityquestion');
			document.getElementById("Txtsecurityanswer").value = sys_user_MainStore.getAt(index).get('securityanswer');
			document.getElementById("TxtNumiscenttypenovalid").value = sys_user_MainStore.getAt(index).get('iscenttypenovalid');
			document.getElementById("TxtNumisfreeze").value = sys_user_MainStore.getAt(index).get('isfreeze');
			document.getElementById("Txtimage").value = sys_user_MainStore.getAt(index).get('image');
			document.getElementById("Txtworkaddress").value = sys_user_MainStore.getAt(index).get('workaddress');
			document.getElementById("Txtselfintroduction").value = sys_user_MainStore.getAt(index).get('selfintroduction');
			document.getElementById("Txturl").value = sys_user_MainStore.getAt(index).get('url');
			document.getElementById("Txtemailactivationaddress").value = sys_user_MainStore.getAt(index).get('emailactivationaddress');
			document.getElementById("Txtemailactivationtime").value = sys_user_MainStore.getAt(index).get('emailactivationtime');
			document.getElementById("Txtremark1").value = sys_user_MainStore.getAt(index).get('remark1');
			document.getElementById("Txtremark2").value = sys_user_MainStore.getAt(index).get('remark2');
			document.getElementById("Txtremark3").value = sys_user_MainStore.getAt(index).get('remark3');
			document.getElementById("TxtNumlockkey").value = sys_user_MainStore.getAt(index).get('lockkey');
			document.getElementById("TxtNumdeletekey").value = sys_user_MainStore.getAt(index).get('deletekey');

            sys_user_Win.show();
        }
    </script>

    <script type="text/javascript">
     
    </script>

    <script type="text/javascript">
        var template = '<span style="color:{0};">{1}</span>';

        var change = function (value) {
            return Ext.String.format(template, (value > 0) ? "green" : "red", value);
        };

        var pctChange = function (value) {
            return Ext.String.format(template, (value > 0) ? "green" : "red", value + "%");
        };

        var prepare = function (grid, command, record, row, col, value) {
            if (value < 0 && command.command == "Dollar") {
                command.hidden = true;
                command.hideMode = "visibility";
            }
        };

        var onCommand = function (column, command, record, recordIndex, cellIndex) {
            // Ext.Msg.alert('Command', 'Command = ' + command + '<br/>' + 'Column = ' + column.grid.columns[cellIndex].dataIndex);
          //  var sys_user_Win = new Ext.Element("sys_user_Win");
           // sys_user_Win.show();

            var Window1 = new Ext.Element.get("Window1");
            Window1.show();

        };
    </script>

</head>
<body>
    <form id="MainForm" runat="server">
    <ext:ResourceManager ID="MainResourceMgr" runat="server" />
    
    <!--用来导出到Excel的数据源-->
    <ext:Hidden ID="ExcelGridData" runat="server" />
    <!--sys_user表页面主数据元，自动生成-->
<%--    <ext:Store runat="server" ID="sys_user_MainStore" OnRefreshData="sys_user_DataBind" AutoLoad="true">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="userid">
 
                <Fields>
                    
					<ext:RecordField Name="userid" />
					<ext:RecordField Name="usertypeid" />
					<ext:RecordField Name="userno" />
					<ext:RecordField Name="username" />
					<ext:RecordField Name="loginname" />
					<ext:RecordField Name="diminutive" />
					<ext:RecordField Name="passwold" />
					<ext:RecordField Name="sex" />
					<ext:RecordField Name="birthday" />
					<ext:RecordField Name="collegeid" />
					<ext:RecordField Name="collegename" />
					<ext:RecordField Name="majorid" />
					<ext:RecordField Name="majorname" />
					<ext:RecordField Name="titleid" />
					<ext:RecordField Name="title" />
					<ext:RecordField Name="rights" />
					<ext:RecordField Name="mobile" />
					<ext:RecordField Name="telphone" />
					<ext:RecordField Name="email" />
					<ext:RecordField Name="address" />
					<ext:RecordField Name="securityquestion" />
					<ext:RecordField Name="securityanswer" />
					<ext:RecordField Name="iscenttypenovalid" />
					<ext:RecordField Name="isfreeze" />
					<ext:RecordField Name="image" />
					<ext:RecordField Name="workaddress" />
					<ext:RecordField Name="selfintroduction" />
					<ext:RecordField Name="url" />
					<ext:RecordField Name="emailactivationaddress" />
					<ext:RecordField Name="emailactivationtime" />
					<ext:RecordField Name="remark1" />
					<ext:RecordField Name="remark2" />
					<ext:RecordField Name="remark3" />
					<ext:RecordField Name="lockkey" />
					<ext:RecordField Name="deletekey" />

                </Fields>
            </ext:JsonReader>
        </Reader> 
        <BaseParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw">
            </ext:Parameter>
            <ext:Parameter Name="limit" Value="15" Mode="Raw">
            </ext:Parameter>
        </BaseParams>
    </ext:Store>--%>
    <!--sys_user页面主表格-->
<%--    <ext:Viewport ID="MainViewPort" runat="server">
        <Items>
            <ext:FitLayout>
                <Items>
                    <ext:GridPanel ID="sys_user_Grid" Layout="fit" TrackMouseOver="true" runat="server" StoreID="sys_user_MainStore"
                        StripeRows="true" Header="false" Border="false" Collapsible="true">
                        <TopBar>
                            <ext:Toolbar ID="MainToolBar" runat="server">
                                <Items>
                                    <ext:Button ID="BtnAdd" runat="server" Text="添加" Icon="Add">
                                        <Listeners>
                                            <Click Handler="#{sys_user_MainForm}.getForm().reset();#{sys_user_Win}.show();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:Button ID="BtnDel" runat="server" Text="删除" Icon="Delete">
                                        <DirectEvents>
                                            <Click OnEvent="BtnDel_Click">
                                                <Confirmation ConfirmRequest="true" Title="确认" Message="确实要删除吗?" />
                                                <EventMask ShowMask="true" Msg="正在删除数据，请等候 ..." />
                                            </Click>
                                        </DirectEvents>
                                        <Listeners>
                                            <Click Handler="if(#{sys_user_Grid}.getSelectionModel().getCount()<=0) {TellAlert('请选择要删除的记录');return false;}" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarSeparator />
                                    <ext:Button ID="BtnReload" runat="server" Text="重新加载" Icon="Reload">
                                        <Listeners>
                                            <Click Handler="#{sys_user_MainStore}.reload();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarFill />
                                    <ext:Button ID="BtnToExcel" runat="server" Text="To Excel" AutoPostBack="true" OnClick="BtnSaveToExcel"
                                        Icon="PageExcel">
                                        <Listeners>
                                            <Click Handler="#{ExcelGridData}.setValue(Ext.encode(sys_user_Grid.getRowsValues(false)));" />
                                        </Listeners>
                                        <ToolTips>
                                            <ext:ToolTip Title="将当前页内容存储为Excel文件">
                                            </ext:ToolTip>
                                        </ToolTips>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <ColumnModel ID="sys_user_ColumnMode" runat="server">
                            <Columns>
                                <ext:RowNumbererColumn Width="20" />
                                <ext:Column Header="主键" Sortable="true" Hidden="true" DataIndex="userid" />
                                
								<ext:Column Header="UserTypeID" Sortable="true" DataIndex="usertypeid" />
								<ext:Column Header="UserNo" Sortable="true" DataIndex="userno" />
								<ext:Column Header="UserName" Sortable="true" DataIndex="username" />
								<ext:Column Header="LoginName" Sortable="true" DataIndex="loginname" />
								<ext:Column Header="Diminutive" Sortable="true" DataIndex="diminutive" />
								<ext:Column Header="Passwold" Sortable="true" DataIndex="passwold" />
								<ext:Column Header="Sex" Sortable="true" DataIndex="sex" />
								<ext:Column Header="Birthday" Sortable="true" DataIndex="birthday" />
								<ext:Column Header="CollegeID" Sortable="true" DataIndex="collegeid" />
								<ext:Column Header="CollegeName" Sortable="true" DataIndex="collegename" />
								<ext:Column Header="MajorID" Sortable="true" DataIndex="majorid" />
								<ext:Column Header="MajorName" Sortable="true" DataIndex="majorname" />
								<ext:Column Header="TitleID" Sortable="true" DataIndex="titleid" />
								<ext:Column Header="Title" Sortable="true" DataIndex="title" />
								<ext:Column Header="Rights" Sortable="true" DataIndex="rights" />
								<ext:Column Header="Mobile" Sortable="true" DataIndex="mobile" />
								<ext:Column Header="Telphone" Sortable="true" DataIndex="telphone" />
								<ext:Column Header="Email" Sortable="true" DataIndex="email" />
								<ext:Column Header="Address" Sortable="true" DataIndex="address" />
								<ext:Column Header="SecurityQuestion" Sortable="true" DataIndex="securityquestion" />
								<ext:Column Header="SecurityAnswer" Sortable="true" DataIndex="securityanswer" />
								<ext:Column Header="IsCenttypeNOValid" Sortable="true" DataIndex="iscenttypenovalid" />
								<ext:Column Header="IsFreeze" Sortable="true" DataIndex="isfreeze" />
								<ext:Column Header="Image" Sortable="true" DataIndex="image" />
								<ext:Column Header="WorkAddress" Sortable="true" DataIndex="workaddress" />
								<ext:Column Header="SelfIntroduction" Sortable="true" DataIndex="selfintroduction" />
								<ext:Column Header="Url" Sortable="true" DataIndex="url" />
								<ext:Column Header="EmailActivationAddress" Sortable="true" DataIndex="emailactivationaddress" />
								<ext:Column Header="EmailActivationTime" Sortable="true" DataIndex="emailactivationtime" />
								<ext:Column Header="Remark1" Sortable="true" DataIndex="remark1" />
								<ext:Column Header="Remark2" Sortable="true" DataIndex="remark2" />
								<ext:Column Header="Remark3" Sortable="true" DataIndex="remark3" />
								<ext:Column Header="LockKey" Sortable="true" DataIndex="lockkey" />
								<ext:Column Header="DeleteKey" Sortable="true" DataIndex="deletekey" />

                            </Columns>
                        </ColumnModel>
                        <Listeners>
                            <RowDblClick Handler="SetWinData(rowIndex);" />
                        </Listeners>
                        <Plugins>
                            <ext:GridFilters runat="server" FiltersText="查找" ID="sys_user_Filter">
                                <Filters>
                                    
								<ext:StringFilter DataIndex="usertypeid" />
								<ext:StringFilter DataIndex="userno" />
								<ext:StringFilter DataIndex="username" />
								<ext:StringFilter DataIndex="loginname" />
								<ext:StringFilter DataIndex="diminutive" />
								<ext:StringFilter DataIndex="passwold" />
								<ext:StringFilter DataIndex="sex" />
								<ext:StringFilter DataIndex="birthday" />
								<ext:StringFilter DataIndex="collegeid" />
								<ext:StringFilter DataIndex="collegename" />
								<ext:StringFilter DataIndex="majorid" />
								<ext:StringFilter DataIndex="majorname" />
								<ext:StringFilter DataIndex="titleid" />
								<ext:StringFilter DataIndex="title" />
								<ext:StringFilter DataIndex="rights" />
								<ext:StringFilter DataIndex="mobile" />
								<ext:StringFilter DataIndex="telphone" />
								<ext:StringFilter DataIndex="email" />
								<ext:StringFilter DataIndex="address" />
								<ext:StringFilter DataIndex="securityquestion" />
								<ext:StringFilter DataIndex="securityanswer" />
								<ext:StringFilter DataIndex="image" />
								<ext:StringFilter DataIndex="workaddress" />
								<ext:StringFilter DataIndex="selfintroduction" />
								<ext:StringFilter DataIndex="url" />
								<ext:StringFilter DataIndex="emailactivationaddress" />
								<ext:StringFilter DataIndex="emailactivationtime" />
								<ext:StringFilter DataIndex="remark1" />
								<ext:StringFilter DataIndex="remark2" />
								<ext:StringFilter DataIndex="remark3" />

                                </Filters>
                            </ext:GridFilters>
                        </Plugins>
                        <a:LoadMask ShowMask="true" Msg="正在加载..." />
                        <SelectionModel>
                            <ext:CheckboxSelectionModel ID="CheckBoxGrid" runat="server" />
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolBar" StoreID="sys_user_MainStore" PageSize="15" runat="server" />
                        </BottomBar>
                    </ext:GridPanel>
                </Items>
            </ext:FitLayout>
        </Items>
    </ext:Viewport>--%>

   <ext:GridPanel 
            ID="GridPanel1" 
            runat="server" 
            Title="Cell commands" 
            Width="700" 
            Height="300">
            <Store>
                <ext:Store ID="Store1" runat="server">
                    <Model>
                        <ext:Model ID="Model1" runat="server">
                            <Fields>
                                <ext:ModelField Name="userid" />
                                <ext:ModelField Name="username"  />
                             
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel ID="ColumnModel1" runat="server">
                <Columns>
                    <ext:Column ID="Column1" runat="server" Text="userid" DataIndex="userid" Flex="1">
                        <Commands>
                            <ext:ImageCommand CommandName="Edit" Icon="NoteEdit" Text="Edit">
                                <ToolTip Text="Edit" />
                            </ext:ImageCommand>
                        </Commands>
                        <Listeners>
                            <Command Fn="onCommand" />
                        </Listeners>
                    </ext:Column>
                    <ext:Column ID="Column2" runat="server" Text="username" Width="100" DataIndex="username" Align="Right" RightCommandAlign="false">
                         
                        <Commands>
                            <ext:ImageCommand CommandName="Dollar" Icon="MoneyDollar" />
                            <ext:ImageCommand CommandName="Euro" Icon="MoneyEuro" />
                        </Commands>
                        <Listeners>
                            <Command Fn="onCommand" />
                        </Listeners>
                    </ext:Column>
                    
                </Columns>
            </ColumnModel>
            <SelectionModel>
               <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Multi" />
            </SelectionModel>          
        </ext:GridPanel>  

    
    <!--sys_user表修改，添加主窗体-->
    <ext:Window ID="sys_user_Win" Collapsible="true" Hidden="true" Modal="true"
        Maximizable="true" runat="server" Title="添加/修改记录" Icon="WorldEdit" Width="630" AutoHeight="true"
        Resizable="true">

    </ext:Window>

      <ext:Window 
            ID="Window1" 
            runat="server" 
            Title="添加用户"  
            Icon="Application"
            Height="600" 
            Hidden="false" 
            Width="504"
            BodyStyle="background-color: #fff;" 
            BodyPadding="5"
            Modal="true">
            <Items>
            <ext:Hidden ID="Hid" runat="server">
            </ext:Hidden>
            <ext:FormPanel ID="sys_user_MainForm" LabelWidth="65" Frame="true" runat="server"
                Border="false" Height="504" Padding="5" Icon="UserAdd" Layout="Column">
                <Items>
                    <ext:Panel ID="Panel1" runat="server" Border="false" Header="false" ColumnWidth="1" Layout="Form">
                        <Items>
                            
							<ext:TextField ID="Txtusertypeid" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="UserTypeID" />
							<ext:TextField ID="Txtusername" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="UserName" />
							<ext:TextField ID="Txtdiminutive" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="Diminutive" />
							<ext:TextField ID="Txtsex" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="Sex" />
							<ext:TextField ID="Txtcollegeid" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="CollegeID" />
							<ext:TextField ID="Txtmajorid" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="MajorID" />
							<ext:TextField ID="Txttitleid" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="TitleID" />
							<ext:TextField ID="Txtrights" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="Rights" />
							<ext:TextField ID="Txttelphone" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="Telphone" />
							<ext:TextField ID="Txtaddress" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="Address" />
							<ext:TextField ID="Txtsecurityanswer" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="SecurityAnswer" />
							<ext:NumberField ID="TxtNumisfreeze" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="IsFreeze" />
							<ext:TextField ID="Txtworkaddress" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="WorkAddress" />
							<ext:TextField ID="Txturl" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="Url" />
							<ext:TextField ID="Txtemailactivationtime" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="EmailActivationTime" />
							<ext:TextField ID="Txtremark2" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="Remark2" />
							<ext:NumberField ID="TxtNumlockkey" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="LockKey" />

                        </Items>
                    </ext:Panel>
         
                </Items>
            </ext:FormPanel>
        </Items>
        <Buttons> 
            <ext:Button Text="提交" ID="BtnSave" runat="server" Icon="Disk">
                <DirectEvents>
                    <Click OnEvent="BtnSave_Click">
                        <EventMask ShowMask="true" Msg="正在提交，请等候 ..."  />
                    </Click>
                </DirectEvents>
                <Listeners>
                    <Click Handler="if (#{sys_user_MainForm}.getForm().isValid()) {;}else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: '您填写的信息不正确，请您确认！', buttons:Ext.Msg.OK});return false;}" />
                </Listeners>
            </ext:Button>
            <ext:Button Text="取消" ID="BtnConcel" Icon="Delete" runat="server">
                <Listeners>
                    <Click Handler="#{Window1}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
        </ext:Window>
 
    </form>
</body>
</html>
